'use strict';

const Service = require('egg').Service;

class UserService extends Service {
    //登录
    async login(username,password) {
        return await this.app.mysql.query('select * from login where username=? and password=?',[username,password])
    }
    //查询此人是否存在
    async selectUser(nickname){
        return await this.app.mysql.query('select * from user where nickname=?',[nickname])
    }
    //添加用户
    async add(hot,address,phone,tid,nickname){
        await this.app.mysql.query('insert into user (hot,address,phone,tid,nickname) values (?,?,?,?,?)',[hot,address,phone,tid,nickname])
    }
    //list
    async list(){
        return await this.app.mysql.query('select * from user')
    }
    //查询用户类型
    async types(){
        return await this.app.mysql.query('select * from type')
    }
    //用户信息
    async info(uuid){
        return await this.app.mysql.query('select * from user where uuid=?',[uuid])
    }
}

module.exports = UserService;
